db.getCollection('messages').ensureIndex({time:-1})